import { Injectable } from '@nestjs/common';
import { CreateGenerateDto } from './dto/create-generate.dto';
import { UpdateGenerateDto } from './dto/update-generate.dto';
import { Generate } from './entities/generate.entity';

@Injectable()
export class GenerateService {
  create(createGenerateDto: CreateGenerateDto) {
    return Generate.save({
      ...createGenerateDto,
      isShow: true,
      create_time: new Date(),
      update_time: new Date(),
      delete_time: null,
    });
  }

  async findAll() {
    const list = [];
    return list;
  }

  findOne(id: number) {
    return Generate.findOneBy({ id });
  }

  update(id: number, updateGenerateDto: UpdateGenerateDto) {
    return Generate.update(id, { ...updateGenerateDto });
  }

  remove(id: number) {
    return Generate.update(id, { delete_time: new Date() });
  }
}
